/* eslint-disable import/prefer-default-export */
import { request } from '@/request/v2';

// 我的信息
export const getInfo = (payload) => {
  return request({
    method: 'GET',
    url: `https://www.thuguardian.com/api/user/get_info`,
    payload,
    codeIgnore: true,
  });
};


// 登录
export const login = (payload) => {
  return request({
    method: 'POST',
    url: `https://www.thuguardian.com/api/login`,
    payload,
    codeIgnore: true,
  });
};

// 获取验证码

export const getCode = (payload) => {
  return request({
    method: 'POST',
    url: `https://www.thuguardian.com/api/get_code`,
    payload,
    codeIgnore: true,
  });
};


// 获取openid

export const getOpenid = (payload) => {
  return request({
    method: 'GET',
    url: `https://api.weixin.qq.com/sns/jscode2session`,
    payload,
    codeIgnore: true,
  });
};

// 获取token

export const getToken = (payload) => {
  return request({
    method: 'GET',
    url: `https://api.weixin.qq.com/cgi-bin/token`,
    payload,
    codeIgnore: true,
  });
};

// 获取手机号

export const getUserphonenumber = (payload) => {
  return request({
    method: 'POST',
    url: `https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=${payload.access_token}`,
    payload: {
      code: payload.code
    },
    codeIgnore: true,
  });
};



// 自评结果保存
export const saveInfo = (payload) => {
  return request({
    method: 'POST',
    url: `https://www.thuguardian.com/api/questionnaire/save_info`,
    payload,
    codeIgnore: true,
  });
};

export const getTaskInfo = (payload) => {
  return request({
    method: 'get',
    url: `https://www.thuguardian.com/api/questionnaire/get_info`,
    payload,
    codeIgnore: true,
  });
};


// 上传图片
export const upload = (payload) => {
  return request({
    method: 'POST',
    url: `https://www.thuguardian.com/upload/upload`,
    payload,
    codeIgnore: true,
  });
};


// 添加设备信息
export const addDevice = (payload) => {
  return request({
    method: 'POST',
    url: `https://www.thuguardian.com/api/device/add`,
    payload,
    codeIgnore: true,
  });
};


// 快捷登录
export const quickLogin = (payload) => {
  return request({
    method: 'POST',
    url: `https://www.thuguardian.com/api//quick_login`,
    payload,
    codeIgnore: true,
  });
};

